class CreateDocuments < ActiveRecord::Migration
  def self.up
    create_table :documents do |t|
	  #common atributes
      t.datetime :issue_date, :null => false
	  t.string :document_type, :null => false
	  t.string :number, :null => false
	  t.integer :source_id, :null => false
      t.integer :target_id, :null => false
      t.string :notes
	  t.integer :employee_id, :null => false
      
	  #invoice attributes
      t.date :selling_date
      t.date :due_date
      t.string :payment_method
      t.integer :corrected_invoice_id
      
      t.string :type
      t.timestamps
    end
  end

  def self.down
    drop_table :documents
  end
end
